package com.tem.seller.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tem.seller.entity.Seller;
import com.api.manage.pojo.seller.SellerBean;
import com.tem.seller.mapper.SellerMapper;
import com.tem.seller.service.ISellerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 腾木
 * @since 2023-11-08
 */
@Service
public class SellerServiceImpl extends ServiceImpl<SellerMapper, Seller> implements ISellerService {
    public boolean checkNumb(String sellerNum,Long sellerId){
        QueryWrapper<Seller> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(Seller::getSellerNum,sellerNum);
        List<Seller> list = baseMapper.selectList(queryWrapper);
        if(list==null || list.size()<1)return false;
        if(sellerId==null) return true;//新增
        if(list.size()>1)return true;
        Seller seller=list.get(0);
        if(seller.getSellerId().equals(sellerId))
            return false;
        return true;
    }
}
